#include <bits/stdc++.h>

using namespace std;
#define int long long
const int inf = 0x3f3f3f3f;

void solve()
{
    int n;
    cin >> n;
    int sum = 0;
    for (int i = 1; i <= n; i++) sum += i;
    // cout << sum << endl;
    if (sum % 2 != 0)
    {
        cout << -1 << endl;
        return;
    }
    int target = sum / 2;
    int r;
    for (r = n; r >= 1; r--)
    {
        if (target % (1 + r) == 0) break;
    }
    int tmp = r;
    int x = target / (1 + r);
    int l = 1;
    for (int j = 0; j < x; j++) cout << l++ << ' ' << r-- << ' ';
    for (int i = l; i <= r; i++) cout << i << ' ';
    for (int i = tmp + 1; i <= n; i++) cout << i << ' ';
    cout << endl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}